/*
 * RSDAO_Factory.java
 *
 * Created on March 23, 2007, 5:26 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package edu.byu.isys413.group1E.data;

import java.util.Map;
import java.util.TreeMap;

/**
 *
 * @author tkulbeth
 */
public class RSDAO_Factory {
    
    private static RSDAO_Factory instance = null;
    	//create the map
    Map<String,RevenueSourceDAO> map = new TreeMap<String,RevenueSourceDAO>();
    
    /** Creates a new instance of RSDAO_Factory */
    public RSDAO_Factory() {

        map.put("sale",SaleDAO.getInstance());
        map.put("rental",RentalDAO.getInstance());
        map.put("print", PrintOrderDAO.getInstance());
        map.put("conversion",ConversionDAO.getInstance());
        map.put("repair",SvcRepairDAO.getInstance());
        map.put("backup",BackupDAO.getInstance());
//        map.put("fee",FeeDAO.getInstance());
    }

    //build the map and return the instance
    public static synchronized RSDAO_Factory getInstance() {
        if (instance == null) {
            instance = new RSDAO_Factory();
        }
        return instance;
    }

    
    public synchronized RevenueSourceDAO getDAO(String id){
        return map.get(id);
    }
}
